package io.renren.modules.generator.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.generator.dao.WgzBuildingDataDao;
import io.renren.modules.generator.entity.WgzBuildingDataEntity;
import io.renren.modules.generator.service.WgzBuildingDataService;
import org.springframework.util.StringUtils;


@Service("wgzBuildingDataService")
public class WgzBuildingDataServiceImpl extends ServiceImpl<WgzBuildingDataDao, WgzBuildingDataEntity> implements WgzBuildingDataService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {

        QueryWrapper<WgzBuildingDataEntity> wgzBuildingDataEntityQueryWrapper = new QueryWrapper<>();

        if (!StringUtils.isEmpty(params.get("building"))){
            wgzBuildingDataEntityQueryWrapper.eq("building",params.get("building"));
        }
        IPage<WgzBuildingDataEntity> page = this.page(
                new Query<WgzBuildingDataEntity>().getPage(params),
                wgzBuildingDataEntityQueryWrapper
        );

        return new PageUtils(page);
    }

}